<template>
  <div class="box" :class="{ playing: isPlaying }" @click="onClick">
    <i
      class="iconfont icon-volumeZero"
      :style="{ fontSize: '18px', color: '#C7CFE0' }"
    ></i>
    <div class="wifi-symbol">
      <div class="wifi-circle first"></div>
      <div class="wifi-circle second"></div>
      <!-- <div class="wifi-circle third"></div> -->
    </div>
  </div>
</template>

<script>
export default {
  name: "SpeakerComponent",
  props: {
    isPlaying: Boolean, // 通过props传递播放状态
  },
  methods: {
    onClick() {
      this.$emit("onClick");
    },
  },
};
</script>

<style lang="scss" scoped>
.box {
  box-sizing: border-box;
  position: relative;
  display: flex;
  align-items: center;
  cursor: pointer;
}
.wifi-symbol {
  width: 50px;
  height: 50px;
  box-sizing: border-box;
  overflow: hidden;
  transform: rotate(135deg);
}
.wifi-circle {
  border: 1px solid #c7cfe0;
  border-radius: 50%;
  position: absolute;
}

.first {
  width: 10px;
  height: 10px;
  top: 45px;
  left: 45px;
}

.second {
  width: 20px;
  height: 20px;
  left: 40px;
  top: 40px;
}

.third {
  width: 30px;
  height: 30px;
  top: 35px;
  left: 35px;
}
.playing .wifi-circle.first {
  animation: fadeInOut 1s infinite 0.2s;
}
.playing .wifi-circle.second {
  animation: fadeInOut 1s infinite 0.4s;
}
.playing .wifi-circle.third {
  animation: fadeInOut 1s infinite 0.4s;
}

@keyframes fadeInOut {
  0% {
    opacity: 0; /*初始状态 透明度为0*/
  }
  100% {
    opacity: 1; /*结尾状态 透明度为1*/
  }
}
</style>
